#ifndef QOTCP_H
#define QOTCP_H

/**
* @file qotcp.h
* @describe QoTcp模块
* @author gaoyuelong
* @date 2022/05/02
*/

#include <QTcpSocket>
#include <QJsonObject>
#include <QObject>

class QoTcp : public QObject
{
    Q_OBJECT
public:
    static QoTcp* getInstance();

    bool isConnected();
    void connectToServer();

    void sendMsg(const QString &);
    bool recvMsg(QJsonObject &);

signals:
    void signalRecvMsg();
private slots:
    void slotRecvMsg();

private:
    bool reconnect();

private:
    QoTcp();
    ~QoTcp();

    QTcpSocket *m_pTcpSocket;
    QByteArray byteArray;
};

#endif // QOTCP_H
